<template>
  <div class="image-previewer-wrapper">
    <ul class="images-wrapper">
      <li class="image-item" v-for="(item, index) in images" @click.stop="previewImage(index)">
        <img class="painting-image" :src="item" alt="" />
      </li>
    </ul>
  </div>
</template>

<script>

import util from '@/util/util'
import ImagePreview from '@/components/vant/image-preview'

export default {
  name: 'ImagePreviewer',
  props: {
    images: {
      type: Array,
      default: function() {
        return []
      }
    },
  },
  data () {
    return {
    }
  },
  created () {
  },
  methods: {
    previewImage: function(index) {
      var urls = []
      this.images.forEach(function(image) {
        urls.push(image)
      })
      var current = urls[index]
      if (util.isWechat()) {
        this.wx.previewImage({ urls: urls, current: current })
      } else {
        ImagePreview(urls, index)
      }
    },
  }
}

</script>

